package com.cloud.spring.repositories;

import com.cloud.spring.demo.entity.User;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.elasticsearch.annotations.Query;
import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;

public interface UserRepository extends ElasticsearchRepository<User, Integer> {
    /**
     * 自定义查询语句
     *
     * @param name
     * @param pageable
     * @return
     */
    @Query("{\"bool\" : {\"must\" : {\"field\" : {\"name\" : \"?0\"}}}}")
    Page<User> findPageByName(String name, Pageable pageable);
}
